<?php



use Illuminate\Http\Request;

$api = app('Dingo\Api\Routing\Router');
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

$api->version("v1",function ($api){
    // 登陆接口 不需要 验证AuthToken
    $api->group(['namespace'=>'App\Api\Controllers'],function ($api){
        $api->any('user/login',"AuthController@login");
        $api->any('user/logout',"AuthController@logout");

        //todo 后续需要放到登录验证中
        $api->any('common/upload',"CommonController@upload");
    });

    // 需要验证AuthToken
    $api->group(['namespace'=>'App\Api\Controllers',"middleware"=>['mini.custom.auth']],function ($api){
        $api->get('user/me',"AuthController@me");
        $api->any('user/logout',"AuthController@logout");
        $api->any('user/refresh',"AuthController@refresh");
        $api->any('user/getUserPhone',"AuthController@getUserPhone");
    });

    // 客户 房间管理
    $api->group(['namespace'=>'App\Api\Controllers',"middleware"=>['mini.custom.auth']],function ($api){
        $api->post('room/checkIn',"RoomController@checkIn");
//        $api->any('user/logout',"AuthController@logout");
//        $api->any('user/refresh',"AuthController@refresh");
//        $api->any('user/getUserPhone',"AuthController@getUserPhone");
    });


    // 客房送物商品
    $api->group(['namespace'=>'App\Api\Controllers',"middleware"=>['mini.custom.auth']],function ($api){
        $api->any('goods/list',"GoodsController@list");
        $api->any('goods/detail',"GoodsController@detail");
    });

    // 点评酒店
    $api->group(['namespace'=>'App\Api\Controllers',"middleware"=>['mini.custom.auth']],function ($api){
        $api->any('review/add','ReviewController@add');
        $api->any('review/check','ReviewController@check');
        $api->any('review/list','ReviewController@list');
    });

    // 吐槽
    $api->group(['namespace'=>'App\Api\Controllers',"middleware"=>['mini.custom.auth']],function ($api){
        $api->any('complaints/list','ComplaintsController@index');
        $api->any('complaints/add','ComplaintsController@add');
        $api->any('complaints/detail','ComplaintsController@detail');
        $api->any('complaints/delete','ComplaintsController@delete');
    });

    // 客房送物
    $api->group(['namespace'=>'App\Api\Controllers',"middleware"=>['mini.custom.auth']],function ($api){
        $api->any('delivery/list','DeliveryController@index');
        $api->any('delivery/order','DeliveryController@order');
        $api->any('delivery/cancel','DeliveryController@cancel');
    });
});
